package com.horizon.cloud.redisson.demo.config;

import lombok.extern.slf4j.Slf4j;
import org.redisson.Redisson;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;

@Configuration
@Slf4j
@ConditionalOnClass(value = Redisson.class)
@EnableConfigurationProperties(RedissonConfig.class)
public class RedissonAutoConfiguration {
    @Bean
    @ConditionalOnMissingBean
    @Order(value=1)
    public RedissonManager redissonManager(RedissonConfig redissonConfig) {
        RedissonManager redissonManager = new RedissonManager(redissonConfig);
        return redissonManager;
    }

    @Bean
    @ConditionalOnMissingBean
    @Order(value = 2)
    public RedissonLock
}
